import os,json
def main(data_path,predition_path):
    with open(os.path.join(data_path, 'annotations.json')) as f:
        data_dict = json.load(f)
    with open(predition_path) as f:
        predition_dict = json.load(f)

    for image_name in predition_dict:
        data_dict[image_name]['stage'] = predition_dict[image_name]
        data_dict[image_name]['stage_pred']=True
    with open(os.path.join(data_path, 'annotations.json'), 'w') as f:
        json.dump(data_dict, f)
if __name__ == '__main__':
    data_path = '/mnt/d/Workspace/MiniReti/'  
    # data_path = '/home/ma-user/work/Dataset/infantImages/'
    predition_path = '../ROP_ridge_segmentation/prediction.json'
    main(data_path,predition_path)